﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace SmoLiteApi
{
    /// <summary/>
    public class ColumnCollection : IEnumerable<Column>
    {
        private List<Column> _columns;

        /// <summary/>
        internal ColumnCollection()
        {
            this._columns = new List<Column>();
        }

        /// <summary/>
        public void Add(Column column)
        {
            this._columns.Add(column);
        }

        /// <summary/>
        public Column this[string name]
        {
            get { return this._columns.Find(value => value.Name == name); }
        }

        /// <summary/>
        public IEnumerator<Column> GetEnumerator()
        {
            return this._columns.GetEnumerator();
        }

        /// <summary/>
        IEnumerator IEnumerable.GetEnumerator()
        {
            return this._columns.GetEnumerator();
        }
    }
}
